@extends('admin.main')
@section('content')

    <div id="dcMain">
        <!-- 当前位置 -->
        <div id="urHere">管理中心<b>></b><strong>编辑幻灯片</strong> </div>   <div class="mainBox" style="height:auto!important;height:550px;min-height:550px;">
            <h3><a href="/carouse" class="actionBtn">首页幻灯片</a>编辑幻灯片</h3>
            @if (count($errors) > 0)
                <div class="error">
                    {{$errors->first()}}
                </div>
            @endif
            <form action="/carouse/edit" method="post" enctype="multipart/form-data">
                <input type="hidden" name="_token" value="{{csrf_token()}}">
                <table width="100%" border="0" cellpadding="8" cellspacing="0" class="tableBasic">
                    @if((!empty($data)))
                        <input type="hidden" name="id" value="{{$data->id}}">
                        <tr>
                        <td></td>
                        <td>
                            <img src="{{$data->pic_url}}" height="50" width="50"/>
                        </td>
                        </tr>
                    @endif
                    <tr>
                        <td width="80" align="right">图片</td>
                        <td>
                            <input type="file" name="img" class="inpMain" />
                        </td>

                    <tr>
                        <td align="right">图片链接</td>
                        <td>
                            <input type="text" name="pic_link" value=""  class="inpMain" />
                        </td>
                    </tr>
                    <tr>
                        <td align="right">是否显示</td>
                        <td>
                            <select name="status">
                                @foreach(config('admin.carouse.status') as $k=>$v)
                                    <option value="{{$k}}">{{$v}}</option>
                                @endforeach
                            </select>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">排序</td>
                        <td>
                            <input type="text" name="sort" value="" size="5" class="inpMain" />
                        </td>
                    </tr>

                    <tr>
                        <td></td>
                        <td>
                            <input name="submit" class="btn" type="submit" value="提交" />
                        </td>
                    </tr>
                </table>
            </form>
        </div>
    </div>
@stop
@section('script')
    <script>
        @if(!empty($data))
        @foreach($data->toArray() as $k=>$v)
            $('[name="{{$k}}"]').val('{{$v}}');
        @endforeach
        @endif
    </script>
@stop
